#!/usr/bin/env bash
#Sizes to make icons.  Update this if we need different size icons
sizes=(16 32 64 128 256)
#Regular Expression used to slice up file name
fnamerex="(.*)\.([^.]*)"

#Loop over input files
for fname
do
    echo $fname
    for size in ${sizes[@]}
    do
        if [[ $fname =~ $fnamerex ]]; then
            outfname="${BASH_REMATCH[1]}-$size.${BASH_REMATCH[2]}";
        else
            outfname="$fname-$size";
        fi

        sips -Z $size $fname --out $outfname


    done
done